# use pkg-config for getting CFLAGS and LDFLAGS
QT_LIBS = QtCore QtGui
QT_MAKE_DIR = qt-build-desktop-PATH___Qt___
EXIST = $(shell pkg-config --exists $(QT_LIBS); echo $$? )
LDFLAGS += $(shell pkg-config --libs $(QT_LIBS))
CFLAGS += $(shell pkg-config  --cflags $(QT_LIBS))
LIBS =

EXTRA_DIST = qt/*

all-local:
	@if [ $(EXIST) -eq 0 ]; \
	then \
		mkdir $(QT_MAKE_DIR); \
		cd $(QT_MAKE_DIR); \
		qmake-qt4 ../qt/qt.pro -r -spec linux-g++ CONFIG+=debug QMLJSDEBUGGER_PATH=/usr/share/qtcreator/qml/qmljsdebugger LIBS+=$(LIBS) INCLUDEPATH+=$(SANDCAT_HEADERS); \
		make; \
	else \
		echo "!!!  these libraries does not exist :: $(QT_LIBS)  !!!"; \
	fi
	
install-exec-local:
	@-if [ $(EXIST) -eq 0 ]; \
	then \
		mkdir -p $(LIB_UI_DIR); \
		sudo cp -f $(QT_MAKE_DIR)/libqt.so.1.0.0 $(LIB_UI_DIR)/libqt.so; \
	else \
		echo "!!!  these libraries does not exist :: $(QT_LIBS)  !!!"; \
	fi
	
uninstall-local:
	@-if [ $(EXIST) -eq 0 ]; \
	then \
		sudo rm $(LIB_UI_DIR)/libqt.so; \
	else \
		echo "!!!  these libraries does not exist :: $(QT_LIBS)  !!!"; \
	fi

clean-local:
	@-if [ $(EXIST) -eq 0 ]; \
	then \
		#cd $(QT_MAKE_DIR) && make clean; \
		echo; \
	else \
		echo "!!!  these libraries does not exist :: $(QT_LIBS)  !!!"; \
	fi
